package com.njmt.cloud.msprovder.controller;

import com.njmt.cloud.msprovder.service.OauthClientDetailsService;
import com.njmt.cloud.msprovder.service.PermissionService;
import com.njwt.cloud.mscommon.support.ApiResponse;
import com.njwt.cloud.mscommon.support.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author <a href="mailto:xingxiaofeng@gtmap.cn">xingxiaofeng</a>
 * @date 2022-06-21
 * @desc PermissionController
 */
@RestController
@RequestMapping("authority")
public class PermissionController extends BaseController {

    //资源认证
    @Autowired
    private OauthClientDetailsService oauthClientDetailsService;
    //菜单服务
    @Autowired
    private PermissionService permissionService;
    @GetMapping("/api/{id}")
   // @ApiOperation(value = "根据用户id获取用户权限信息")
    public ApiResponse getAuthorityByUserId(@PathVariable String id) {
        return success(permissionService.findAuthorityByUserId(id));
    }
    @GetMapping("/api/info")
   // @ApiOperation(value = "根据clientId获取认证客户端详情信息")
    public ApiResponse getOauthClientDetailsByClientId(@RequestParam String clientId) {
        return success(oauthClientDetailsService.findOauthClientDetailsByClientId(clientId));
    }


}
